package automaton;

public class TransitionImpl<T> implements Transition<T> {
	private final State source;

	private final T label;

	private final State target;
	/* Added by Lam Ho */
	private boolean started = false;
	private boolean terminated = false;
	/*
	 * started & terminated are used to visualize the acknowledgment
	 * of a word in the editor.
	 * started = true: this transition is the first transition in the acknowledgment
	 * terminated = true: this transition is the last transition in the acknowledgment
	 */
	/* End: Added by Lam Ho */
	
	public TransitionImpl(State source, T label, State target) {
		this.source = source;
		this.label = label;
		this.target = target;
	}

	public State source() {
		return source;
	}

	public T label() {
		return label;
	}

	public State target() {
		return target;
	}
	
	/* Added by Lam Ho */
	public boolean isStarted() {
		return started;
	}

	public void setStarted(boolean started) {
		this.started = started;
	}

	public boolean isTerminated() {
		return terminated;
	}

	public void setTerminated(boolean terminated) {
		this.terminated = terminated;
	}
	/* End: Added by Lam Ho */
	
	public String toString() {
		return "transition : " + source + ", " + '"' + label + '"' + ", "
				+ target;
	}
}
